var e = require;
var t = module;
var n = exports;
var o,
    i =
        (this && this.__extends) ||
        ((o = function (e, t) {
            return (o =
                Object.setPrototypeOf ||
                ({__proto__: []} instanceof Array &&
                    function (e, t) {
                        e.__proto__ = t;
                    }) ||
                function (e, t) {
                    for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]);
                })(e, t);
        }),
        function (e, t) {
            function n() {
                this.constructor = e;
            }
            o(e, t), (e.prototype = null === t ? Object.create(t) : ((n.prototype = t.prototype), new n()));
        }),
    r =
        (this && this.__decorate) ||
        function (e, t, n, o) {
            var i,
                r = arguments.length,
                a = r < 3 ? t : null === o ? (o = Object.getOwnPropertyDescriptor(t, n)) : o;
            if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) a = Reflect.decorate(e, t, n, o);
            else
                for (var s = e.length - 1; 0 <= s; s--)
                    (i = e[s]) && (a = (r < 3 ? i(a) : 3 < r ? i(t, n, a) : i(t, n)) || a);
            return 3 < r && a && Object.defineProperty(t, n, a), a;
        },
    a =
        (this && this.__awaiter) ||
        function (e, a, s, c) {
            return new (s = s || Promise)(function (n, t) {
                function o(e) {
                    try {
                        r(c.next(e));
                    } catch (e) {
                        t(e);
                    }
                }
                function i(e) {
                    try {
                        r(c.throw(e));
                    } catch (e) {
                        t(e);
                    }
                }
                function r(e) {
                    var t;
                    e.done
                        ? n(e.value)
                        : ((t = e.value) instanceof s
                              ? t
                              : new s(function (e) {
                                    e(t);
                                })
                          ).then(o, i);
                }
                r((c = c.apply(e, a || [])).next());
            });
        },
    s =
        (this && this.__generator) ||
        function (n, o) {
            var i,
                r,
                a,
                s = {
                    label: 0,
                    sent: function () {
                        if (1 & a[0]) throw a[1];
                        return a[1];
                    },
                    trys: [],
                    ops: []
                },
                e = {next: t(0), throw: t(1), return: t(2)};
            return (
                "function" == typeof Symbol &&
                    (e[Symbol.iterator] = function () {
                        return this;
                    }),
                e
            );
            function t(t) {
                return function (e) {
                    return (function (t) {
                        if (i) throw new TypeError("Generator is already executing.");
                        for (; s; )
                            try {
                                if (
                                    ((i = 1),
                                    r &&
                                        (a =
                                            2 & t[0]
                                                ? r.return
                                                : t[0]
                                                ? r.throw || ((a = r.return) && a.call(r), 0)
                                                : r.next) &&
                                        !(a = a.call(r, t[1])).done)
                                )
                                    return a;
                                switch (((r = 0), (t = a ? [2 & t[0], a.value] : t)[0])) {
                                    case 0:
                                    case 1:
                                        a = t;
                                        break;
                                    case 4:
                                        return s.label++, {value: t[1], done: !1};
                                    case 5:
                                        s.label++, (r = t[1]), (t = [0]);
                                        continue;
                                    case 7:
                                        (t = s.ops.pop()), s.trys.pop();
                                        continue;
                                    default:
                                        if (
                                            !(a = 0 < (a = s.trys).length && a[a.length - 1]) &&
                                            (6 === t[0] || 2 === t[0])
                                        ) {
                                            s = 0;
                                            continue;
                                        }
                                        if (3 === t[0] && (!a || (t[1] > a[0] && t[1] < a[3]))) {
                                            s.label = t[1];
                                            break;
                                        }
                                        if (6 === t[0] && s.label < a[1]) {
                                            (s.label = a[1]), (a = t);
                                            break;
                                        }
                                        if (a && s.label < a[2]) {
                                            (s.label = a[2]), s.ops.push(t);
                                            break;
                                        }
                                        a[2] && s.ops.pop(), s.trys.pop();
                                        continue;
                                }
                                t = o.call(n, s);
                            } catch (e) {
                                (t = [6, e]), (r = 0);
                            } finally {
                                i = a = 0;
                            }
                        if (5 & t[0]) throw t[1];
                        return {value: t[0] ? t[1] : void 0, done: !0};
                    })([t, e]);
                };
            }
        };
Object.defineProperty(n, "__esModule", {value: !0});
var c,
    l = e("index"),
    u = e("env"),
    p = e("platform-const"),
    h = e("user-data"),
    d = e("panel-manager"),
    f = e("player-info"),
    m = e("player-war"),
    t = cc._decorator,
    e = t.ccclass,
    t = t.property,
    e =
        ((c = cc.Component),
        i(y, c),
        (y.prototype.onLoad = function () {
            (this.logo.spriteFrame = this.logoSpriteFrame[u.env.logo]),
                (this.addDeskBtn.node.active = l.platform.string() != p.PlatformCode.Wechat),
                (this.varsionLabel.string = "v" + u.env.version),
                (this.idLabel.string = "ID:" + h.userData.getUid());
        }),
        (y.prototype.start = function () {
            (this.warLockNode.active = !m.playerWar.getWarLevelUnlock(0)),
                (this.warLockNode2.active = !m.playerWar.getWarLevelUnlock(0)),
                (this.warBtn.interactable = m.playerWar.getWarLevelUnlock(0));
        }),
        (y.prototype.enterGame = function () {
            return a(this, void 0, void 0, function () {
                return s(this, function (e) {
                    switch (e.label) {
                        case 0:
                            return (
                                e.trys.push([0, 1, , 3]),
                                f.playerInfo.setGameType(f.gameType.nomal),
                                cc.director.loadScene("game", function () {}),
                                [3, 3]
                            );
                        case 1:
                            return (
                                e.sent(),
                                [
                                    4,
                                    l.platform.showModal({
                                        title: "友情提示",
                                        content: "加载游戏场景出现问题，请退出重试",
                                        confirmText: "确定",
                                        showCancel: !1
                                    })
                                ]
                            );
                        case 2:
                            return e.sent(), [3, 3];
                        case 3:
                            return [2];
                    }
                });
            });
        }),
        (y.prototype.startGame = function () {
            this.enterGame();
        }),
        (y.prototype.warGame = function () {
            d.PanelManager.ins.open("prefab/panel/warPanel", null);
        }),
        (y.prototype.setting = function () {
            d.PanelManager.ins.open("prefab/panel/loadSettingPanel", null);
        }),
        (y.prototype.addDesk = function () {
            l.platform.addShortcut();
        }),
        (y.prototype.skin = function () {
            d.PanelManager.ins.open("prefab/panel/skinPanel", null);
        }),
        (y.prototype.onAds = function () {}),
        (y.prototype.onAdsLockCallBack = function () {
            var e = m.playerWar.getWarLevelUnlock(0);
            e
                ? console.log("error unlock...", e)
                : (console.log("unlock....", 0),
                  m.playerWar.setWarLevelUnlock(0, !0),
                  l.platform.trackEvent("unlock_challenge", {level: 1}),
                  (this.warLockNode.active = !1),
                  (this.warLockNode2.active = !1),
                  (this.warBtn.interactable = !0),
                  this.warGame());
        }),
        r([t(cc.Sprite)], y.prototype, "logo", void 0),
        r([t([cc.SpriteFrame])], y.prototype, "logoSpriteFrame", void 0),
        r([t(cc.Button)], y.prototype, "warBtn", void 0),
        r([t(cc.Node)], y.prototype, "warLockNode", void 0),
        r([t(cc.Node)], y.prototype, "warLockNode2", void 0),
        r([t(cc.Button)], y.prototype, "addDeskBtn", void 0),
        r([t(cc.Label)], y.prototype, "varsionLabel", void 0),
        r([t(cc.Label)], y.prototype, "idLabel", void 0),
        r([e], y));
function y() {
    var e = (null !== c && c.apply(this, arguments)) || this;
    return (
        (e.logo = null),
        (e.logoSpriteFrame = []),
        (e.warBtn = null),
        (e.warLockNode = null),
        (e.warLockNode2 = null),
        (e.addDeskBtn = null),
        (e.varsionLabel = null),
        (e.idLabel = null),
        e
    );
}
n.default = e;
